package com.muki.wareHouse;

import java.nio.file.Path;
import java.util.Iterator;

public class RemoteCorpusHouse extends CorpusHouse {

	//默认ip地址
	private String ip_address = "127.0.0.1";
	//默认端口
	private int port=17171;
	//默认存储路径
	private String base_path = "";
	
	private RouteMap routes;
	
	public RemoteCorpusHouse(String ip,int port,String base_path,RouteMap routes) {
		this.ip_address = ip;
		this.port = port;
		this.base_path = base_path;
		this.routes = routes;
	}

	@Override
	public int inHouse(ListCorpus list) {
		int count = 0;
		Iterator<CorpusParser> it = list.iterator();
		while(it.hasNext()) {
			CorpusParser cp = it.next();
			Path path = cp.remoteSave(ip_address,port,base_path);
			if(path!=null) {
				count++;
			}
		}
		list.clear();
		return count;
	}
}
